#include <bits/stdc++.h>

using namespace std;
const int N=1e5+5;
int L[N],R[N],a[N];

signed main(){
    freopen("duel.in","r",stdin);
    freopen("duel.out","w",stdout);
    int n;
    cin>>n;
    for(int i=1;i<=n;i++){
        cin>>a[i];
    }
    sort(a+1,a+n+1);

    int k=0;
    for(int i=1;i<=n;i++){
        if(i==1||a[i]!=a[i-1]){
            k++;
            L[k]=R[k]=i;
        }
        else{
            R[k]++;
        }
    }

    int res=0;
    for(int i=2;i<=k;i++){
        res+=min(R[i]-L[i]+1,R[i-1]-L[i-1]+1);
    }
    cout<<n-res;
    return 0;
}
